package com.zjut.zs.hjqk.manager;

import java.util.List;

import javax.annotation.Resource;

import com.zjut.an.util.module.PageModule;
import com.zjut.zs.hjqk.dao.ZsHjqk;
import com.zjut.zs.hjqk.dao.ZsHjqkDAO;
import com.zjut.zs.user.dao.ZsUser;


public class ZsHjqkManager {

	@Resource(name = "ZsHjqkDAO")
	private ZsHjqkDAO dao;
	
	public void addData(ZsHjqk obj) {	
		dao.save(obj);
	}
	
	public void updateData(ZsHjqk obj) {
		dao.update(obj);
	}
	
	public void deleteData(ZsHjqk obj) {
		dao.delete(obj);
	}

	public void deleteDatas(List<ZsHjqk> objlist) {
		for (ZsHjqk ZsHjqk : objlist) {
			dao.delete(ZsHjqk);
		}
	}
	
	public PageModule getDataByInstance (int pageNumber,int pageSize, String sort, String order, ZsHjqk obj) {
		return dao.findByInstance(pageNumber, pageSize, sort, order, obj);
	}
	
	public List getDatas() {
		return dao.findAll();
	}

	public ZsHjqk getData(String objId) {
		return dao.findById(objId);
	}

	public List getDataByUser(ZsUser user) {
		ZsHjqk obj = new ZsHjqk();
		obj.setZsUser(user);
		return this.getDataByInstance(1, 1000, null, null, obj).getObjects();
	}
}
